home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / modex105 / demos / qb45 / utils.obj < prev   
Encoding:
Text File  |  1993-05-14  |  628 b   |  32 lines

  1. nstrate the GetImage and PutImage commands }
  2.  
  3. const
  4.   r  = 20;
  5.   StartX = 100;
  6.   StartY = 50;
  7.  
  8. var
  9.   CurPort : ViewPortType;
  10.  
  11. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  12. var
  13.   Step : integer;
  14. begin
  15.   Step := Random(2*r);
  16.   if Odd(Step) then
  17.     Step := -Step;
  18.   X := X + Step;
  19.   Step := Random(r);
  20.   if Odd(Step) then
  21.     Step := -Step;
  22.   Y := Y + Step;
  23.  
  24.   { Make saucer bounce off viewport walls }
  25.   with CurPort do
  26.   begin
  27.     if (x1 + X + Width - 1 > x2) then
  28.       X := x2-x1 - Width + 1
  29.     else
  30.       if (X < 0) then
  31.         X := 0;
  32.     if (y1 + Y + Height - 1 > y2) t